<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="contextPath" value="${pageContext.request.contextPath}"/>
<%@include file="../../common/operation_forbid.jsp" %>
<script type="text/javascript">
    var contextPath = '${contextPath}';
    var documentType= ${documentType};
</script>
<%@include file="../../common/jsVersion.jsp"%>
<!DOCTYPE html >
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>客户新增</title>
    <!-- neptune -->
    <%@include file="../../common/extInclude.jsp" %>
    <script type="text/javascript" src="${contextPath}/static/js/components/giveUpCustomerComponent.js?v=${jsVersion}"></script>
    <script type="text/javascript" src="${contextPath}/static/js/components/estateComponent.js?v=${jsVersion}"></script>
    <script type="text/javascript" src="${contextPath}/static/js/customer/customer/addLC.js?v=${jsVersion}"></script>
    <script type="text/javascript" src="${contextPath}/static/js/jquery/json2.js"></script>
    <script type="text/javascript" src="${contextPath}/static/js/jquery/jquery-2.0.3.min.js"></script>
    <script type="text/javascript" src="${contextPath}/static/plugins/layer/2.1/layer.js"></script>
    <script type="text/javascript" src="${contextPath}/static/plugins/layer/2.1/extend/layer.ext.js"></script>
    <script type="text/javascript" src="${contextPath}/static/plugins/layer/2.1/skin/layer.css"></script>

</head>
<script type="text/javascript">
var resourcesCode = "${resourcesCode}";
var userName = "${userName}";
var projectId = "";
var paymentMethod = JSON.parse('${paymentMethod}');
var peAcademicQualifications = JSON.parse('${peAcademicQualifications}');
var congShiHangYeEnum = JSON.parse('${congShiHangYeEnum}');
var companyXingZhiEnum = JSON.parse('${companyXingZhiEnum}');
var riChangXinXiEnum = JSON.parse('${riChangXinXiEnum}');
var familyJieEnum = JSON.parse('${familyJieEnum}');
var customerPhone = '${customerPhone}';
var serverDate = '${serverDate}';
var addPanelObj = null;
var cbstore = null;
var defaultProjectId = "${projectId}";
Ext.onReady(function() {
	cbstore = new Ext.data.Store({
		        singleton:true,
		        autoDestroy:true,
		        fields: ["projectName", "id"],
		        proxy:{
		            type:'ajax',
		            url:contextPath+'/customer/follow/returnProjectName?resourcesCode=menu_0003_0001&resourcesName=resName_pro_list',
		            reader:{
	                   type: 'json', 
	                   root: 'root'  //数据
	              }
		        } 
	});
	Ext.tip.QuickTipManager.init()
	addPanelObj= Ext.create("customer.payDeposit.addPanel");
  	cbstore.load({
 		 callback:function(){
 			if(defaultProjectId==""){
 				var totalCount=cbstore.getTotalCount();
 	 			if(totalCount>0){
 	 				var firstProjectId=cbstore.getAt(0).data.id;
 	 				projectId=firstProjectId;
 	 				var combox = Ext.getCmp('cbstore');
 	 				combox.setValue(firstProjectId);
 	 			}
 			}else{
 				if(defaultProjectId!="null"){
 					var combox = Ext.getCmp('cbstore');
 		 			combox.setValue(parseInt(defaultProjectId));
 				}
 				
 			}
 			
			
		}  
	});
  	if(customerPhone!=null&&customerPhone!=""){
  		Ext.getCmp("customerPhone").focus();
  	}
	
//  	cbstore.load({ 
// 		callback: function(records, options, success){ 
// 	    	combox.select(projectId);
// 			console.log(combox);
// 			if(projectId){
// 				var combox = Ext.getCmp('cbstore');
// 	    		var index = cbstore.find('id',projectId); 
// 		    	combox.setRawValue(cbstore.getAt(index).data.projectName);
// 		    	combox.setValue(parseInt(projectId));
// 		    	addPanelObj.getForm().projectId=projectId;
// 				Ext.getCmp('cbstore').setValue(projectId);
// 				Ext.getCmp('cbstore').getStore().reload(); 
// 				return cbstore.getAt(index).data.projectName;
// 			}
// 		} 
// 	}); 
});
</script>
<body style="height: 100%">
</body>
</html>